Real-Time Persistent Queues and Deques with Logic Variables (Declarative Pearl)
نویسنده
چکیده
We present a Prolog implementation of real-time persistent queues and double-ended queues. Our implementation is inspired by Okasaki’s lazy-functional approach, but relies only on standard Prolog, comprising of the pure subset plus if-then-else constructs to efficiently implement guards and meta-calls for convenience. The resulting data structure is a nice demonstration of the fact that the use of logic variables to hold the outcome of an unfinished computation can sometimes give the same kind of elegant and compact solutions as lazy evaluation.
منابع مشابه
Practical Memory Checkers for Stacks, Queues and Deques
A memory checker for a data structure provides a method to check that the output of the data structure operations is consistent with the input even if the data is stored on some insecure medium. In 8] we present a general solution for all data structures that are based on insert(i; v) and delete(j) commands. In particular this includes stacks, queues, deques (double-ended queues) and lists. Her...
متن کاملSimple and Efficient Purely Functional Queues and Deques
We present purely functional implementations of queues and double-ended queues (deques) requiring only O(1) time per operation in the worst case. Our algorithms are considerably simpler than previous designs with the same bounds. The inspiration for our approach is the incremental behavior of certain functions on lazy lists.
متن کاملBernoulli Vacation Policy for a Bulk Retrial Queue with Fuzzy Parameters
In this paper, we investigate the fuzzy logic based system characteristics of MX/G/1 retrial queuing system with Bernoulli vacation schedule. The service time and vacation time are assumed to be generally distributed. It is found in many practical situations that the queuing models with fuzzy parameters are much more realistic than the classical crisp parameters based queuing models. We have...
متن کاملConfluently Persistent Deques via Data Structural Bootstrapping
We introduce data structural bootstrapping, a technique to design data structures recursively, and use it to design confluently persistent deques. Our data structure requires O(log* k) amortized time and space per deletion, where k is the total number of deque operations, and constant amortized time for other operations. This improves a previous result of Driscoll, Sleator, and Tarjan.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2012